//if
//在pipeline外部定义全局变量
branchName = 'dev'

pipeline {
  agent any
  stages {
    stage{"run"}(
      steps{
        script{
          if (branchName == 'dev'){
            println("deploy to dev environment")
          }else if (branchName == 'master'){
            println("deploy to master environment")
          }else{
            println("ERROR")
          }
        }
      }
    )
  }
}